package com.hzj.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import com.hzj.pojo.User;
import com.hzj.service.UserService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author hzj
 * @since 2021-07-29
 */
@RestController
//@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService service;

    @RequestMapping("/add")
    public String add() {
        User user = new User();
        user.setName("黄" + (Math.random() * 100));
        user.setAge(18);
        user.setMoney(100L);
        user.setSex("男");
//        boolean save = service.save(user);
        int save = service.insertUser(user);
        return "" + save;
    }

    @GetMapping("/edit")
    public String edit() {
        return service.edit();
    }
}

